package com.itheima.mall.service.smsService;


import com.itheima.mall.commons.PageBean;
import com.itheima.mall.commons.R;
import com.itheima.pojo.sms.SmsFlashPromotion;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class SmsFlashPromotionService {


    @DubboReference
    private SmsFlashPromotionApi smsFlashPromotionApi;

    /**
     * 活动添加
     */
    public void saved(Map<String ,Object> map) {
        smsFlashPromotionApi.saved(map);
    }
    /**
     * 删除活动
     */
    public void deleteFlash(Integer id) {
        smsFlashPromotionApi.deleteFlash(id);
    }
    /**
     * 根据活动名称分页查询
     */
    public R listFlash(String keyword, Integer pageNum, Integer pageSize) {
        PageBean<SmsFlashPromotion> res = smsFlashPromotionApi.listFlash(keyword, pageNum, pageSize);
        return R.ok(res);
    }
    /**
     * 修改上下线状态
     */
    public R updateStatus(Integer id, Integer status) {
        return smsFlashPromotionApi.updateStatus(id,status);
    }
    /**
     *  编辑活动
     */
    public R updateFlashId(Integer id, SmsFlashPromotion smsFlashPromotion) {
        return smsFlashPromotionApi.updateFlashId(id,smsFlashPromotion);
    }
    /**
     *获取活动详情
     */
    public R getFlash(Integer id) {
        return smsFlashPromotionApi.getFlash(id);
    }
}
